package com.parent.elasticsearch.old.esentitys;


import com.parent.elasticsearch.old.es.Total;
import com.parent.elasticsearch.old.result.Hits;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.List;


/**
 * @author yan
 * @date 2023/7/20 0020 22:43
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Hits1<T> implements Serializable {
    private static final long serialVersionUID = -3485329361916226618L;
    /**
     * 查询总数
     */
    private Total total;
    /**
     * 最大分数
     */
    private Double max_score;
    private List<HitsNew1<T>> hits;

    public static Hits toResult(Hits1 hits) {
        Double max_score = hits.getMax_score();
        Hits hitsNew = new Hits();
        BeanUtils.copyProperties(hits, hitsNew);
        hitsNew.setMaxScore(max_score);
        return hitsNew;
    }





}